<template>
  <div class="home">
    <div class="bg" :style="`height: ${height==0?'100%':height+'px'};margin-top: -${marginTop}px;width:${width==0?'100%':width+'px'};margin-left:-${marginLeft}px`">
      <video width="100%" height="100%" src="../assets/video/video.mp4" loop muted autoplay></video>
    </div>
    <div class="logo">廉江新型智慧城市</div>
    <router-link to="index" class="btn">
      <button>进入网站</button>
    </router-link>
    <div class="footer">
      广东国地规划科技股份有限公司 版权所有 粤ICP备19020983号
    </div>
  </div>
</template>

<script>
export default {
  name: "Home",
  components: {
    // HelloWorld
  },
  data() {
    return {
      height: 0,
      width: 0,
      marginTop: 0,
      marginLeft: 0
    };
  },
  mounted() {
    var winWidth = parseInt(window.innerWidth);
    var winHeight = parseInt(window.innerHeight);
    var w = winWidth / 16;
    var h = winHeight / 9;
    var mt;
    if (w > h) {
      var height = w * 9;
      if (height > winHeight) {
        mt = (height - winHeight) / 2;
        this.height = height;
        this.marginTop = mt;
      } else {
        mt = (winHeight - height) / 2;
        this.marginTop = mt;
      }
    } else {
      var width = h * 16;
      if (width > winWidth) {
        mt = (width - winWidth) / 2;
        this.width = width;
        this.marginLeft = mt;
      } else {
        mt = (winWidth - width) / 2;
        this.width = width;
      }
    }
  }
};
</script>

<style lang="scss">

.home {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: #000;
  .bg {
    // margin-top: -70px;
    width: 100%;
    height: 1080px;
  }
  .logo {
    position: absolute;
    left: 80px;
    top: 60px;
    z-index: 2;
    width: 250px;
    height: 80px;
    font-size: 30px;
    color: #000;
    // background: url(../assets/imgs/logo.png) no-repeat;
    text-align: center;
    font-family: cursive;
    font-weight: 800;
    background-size: auto 80px;
  }
  .btn {
    position: absolute;
    bottom: 50px;
    left: 50%;
    margin-left: -300px;
    width: 600px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 2;
    button {
      height: 50px;
      width: 250px;
      text-align: center;
      line-height: 50px;
      cursor: pointer;
      background-color: rgba($color: #000000, $alpha: 0.2);
      color: #fff;
      border: 1px solid #fff;
      outline: none;
      border-radius: 8px;
      font-size: 16px;
      user-select: none;
      &:hover {
        background-color: rgba($color: #fff, $alpha: 0.2);
      }
    }
  }
}
</style>